package com.s2015.doors.web;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.s2015.doors.service.TestService;

/**
 * Servlet implementation class TestIndex
 */
@Component
public class TestIndex extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Autowired
	private TestService testService = null;
	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public TestIndex() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse resp) throws ServletException, IOException {
	
		PrintWriter w = resp.getWriter();
		w.println(" ok!!!!!!!!!");
		w.println(testService.selectUser("1"));
		w.flush();
		w.close();
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

	public TestService getTestService() {
		return testService;
	}

	public void setTestService(TestService testService) {
		this.testService = testService;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}
